<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:include href="./SectionElementSave.xsl"/>
	
	<xsl:template match="/">
		<xsl:apply-templates select="/html/body" />
	</xsl:template>

	<xsl:template match="body">
		<generation-template>
			<outputFolder>
				<xsl:value-of select="form/input[@id='outputFolderPath']/@value" />
			</outputFolder>
			<xsl:apply-templates select="div[@id='descriptors']/div[@class='descriptor']"/>
		</generation-template>
	</xsl:template>

	<xsl:template match="div[@class='descriptor']">
		<descriptor templateRef="{.//select/option[@selected]/@value}">
			<filter>
				<xsl:value-of select=".//textarea" />
			</filter>
			<path>
				<xsl:apply-templates select=".//div[@type='genPath']"/>
			</path>
			<body>
				<xsl:apply-templates select=".//div[@type='body']"/>
			</body>
		</descriptor>
	</xsl:template>
	
	<xsl:template match="br">
		<br/>
	</xsl:template>
</xsl:stylesheet>